<?php /* Smarty version Smarty-3.1.12, created on 2013-06-03 23:23:19
         compiled from "D:\redwazi2\sys-admin\template\cms\channel_common.htm" */ ?>
<?php /*%%SmartyHeaderCode:824751acb4e7524516-38831862%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '01895d149be09a10e3dd12c4eb05fa12b6f68b83' => 
    array (
      0 => 'D:\\redwazi2\\sys-admin\\template\\cms\\channel_common.htm',
      1 => 1366867474,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '824751acb4e7524516-38831862',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'tp_name_1' => 0,
    'headblocks' => 0,
    'headblock' => 0,
    'tp_name_2' => 0,
    'footblocks' => 0,
    'footblock' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.12',
  'unifunc' => 'content_51acb4e7659543_22189451',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_51acb4e7659543_22189451')) {function content_51acb4e7659543_22189451($_smarty_tpl) {?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>Yooes管理中心</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="/sys-admin/css/general.css" rel="stylesheet" type="text/css">
<link href="/sys-admin/css/main.css" rel="stylesheet" type="text/css">
<script src="/sys-admin/js/jquery.js" type="text/javascript"></script>
<script src="/sys-admin/js/cn_message.js" type="text/javascript"></script>
<script src="/sys-admin/js/validate.js" type="text/javascript"></script>
<script src="/sys-admin/js/common.js" type="text/javascript"></script>
<script src="/sys-admin/js/jquery.form.js" type="text/javascript"></script>
</head>
<body>
<h1>
<span class="action-span1">共用内容管理</span>
</h1>
<div class="tab-div">
 	<div id="tabbar-div"><p><span class="tab-front" id="channel-hard-tab">头部</span>
 	<a href="javascript:popAddCommonBlock(1);" class="fr mr10">+添加内容块</a>
 	 <a href="javascript:staticCommon(1);" class="fr mr10">生成网页</a>
 	<a href="/sys-admin/action/cms/channel.php?met=commontemplateui&pos=1" class="fr mr10">选择模板</a><span class="fr mr10">模板：<a href="javascript:;"><?php echo $_smarty_tpl->tpl_vars['tp_name_1']->value;?>
</a></span></p></div>
	<div class="list-div">
	<table cellpadding="2" cellspacing="1" width="100%" id="tb_1">
  	<tr>
    <th class="num">#</th>
    <th>块名</th>
    <th>唯一码</th>
    <th width="20%">类型</th>
    <th width="20%">操作</th>
  	</tr>
  	<?php  $_smarty_tpl->tpl_vars['headblock'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['headblock']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['headblocks']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['i']['index']=-1;
foreach ($_from as $_smarty_tpl->tpl_vars['headblock']->key => $_smarty_tpl->tpl_vars['headblock']->value){
$_smarty_tpl->tpl_vars['headblock']->_loop = true;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['i']['index']++;
?>
    <tr id="b_<?php echo $_smarty_tpl->tpl_vars['headblock']->value['block_id'];?>
">
	<td class="num"><?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['i']['index']+1;?>
</td>
	<td><?php echo $_smarty_tpl->tpl_vars['headblock']->value['block_name'];?>
</td>
	<td><?php echo $_smarty_tpl->tpl_vars['headblock']->value['block_sn'];?>
</td>
	<td><?php if ($_smarty_tpl->tpl_vars['headblock']->value['block_type']==1){?>超链接<?php }elseif($_smarty_tpl->tpl_vars['headblock']->value['block_type']==2){?>图片<?php }elseif($_smarty_tpl->tpl_vars['headblock']->value['block_type']==3){?>产品<?php }?></td>
	<td>
	<a href="javascript:delBlock(<?php echo $_smarty_tpl->tpl_vars['headblock']->value['block_id'];?>
);">删除</a>
	<a href="javascript:popEditBlockName(<?php echo $_smarty_tpl->tpl_vars['headblock']->value['block_id'];?>
);">修改名称</a>
	<a href="/sys-admin/action/cms/store.php?met=storelist&bid=<?php echo $_smarty_tpl->tpl_vars['headblock']->value['block_id'];?>
">内容管理</a>
	</td>
    </tr>
    <?php } ?>
  	</table>
 	</div>
</div>
<div class="tab-div">
 <div id="tabbar-div"><p><span class="tab-front" id="channel-foot-tab">尾部</span>
 <a href="javascript:popAddCommonBlock(2);" class="fr mr10">+添加内容块</a>
 <a href="javascript:staticCommon(2);" class="fr mr10">生成网页</a>
 <a href="/sys-admin/action/cms/channel.php?met=commontemplateui&pos=2" class="fr mr10">选择模板</a><span class="fr mr10">模板：<a href="javascript:;"><?php echo $_smarty_tpl->tpl_vars['tp_name_2']->value;?>
</a></span></p></div>
<div class="list-div">
	<table cellpadding="2" cellspacing="1" width="100%" id="b_2">
  	<tr>
    <th class="num">#</th>
    <th>块名</th>
    <th>唯一码</th>
    <th width="20%">类型</th>
    <th width="20%">操作</th>
  	</tr>
  	<?php  $_smarty_tpl->tpl_vars['footblock'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['footblock']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['footblocks']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['i']['index']=-1;
foreach ($_from as $_smarty_tpl->tpl_vars['footblock']->key => $_smarty_tpl->tpl_vars['footblock']->value){
$_smarty_tpl->tpl_vars['footblock']->_loop = true;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['i']['index']++;
?>
    <tr id="b_<?php echo $_smarty_tpl->tpl_vars['footblock']->value['block_id'];?>
">
	<td class="num"><?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['i']['index']+1;?>
</td>
	<td><?php echo $_smarty_tpl->tpl_vars['footblock']->value['block_name'];?>
</td>
	<td><?php echo $_smarty_tpl->tpl_vars['footblock']->value['block_sn'];?>
</td>
	<td><?php if ($_smarty_tpl->tpl_vars['footblock']->value['block_type']==1){?>超链接<?php }elseif($_smarty_tpl->tpl_vars['footblock']->value['block_type']==2){?>图片<?php }elseif($_smarty_tpl->tpl_vars['footblock']->value['block_type']==3){?>产品<?php }?></td>
	<td>
	<a href="javascript:delBlock(<?php echo $_smarty_tpl->tpl_vars['footblock']->value['block_id'];?>
);">删除</a>
	<a href="javascript:popEditBlockName(<?php echo $_smarty_tpl->tpl_vars['footblock']->value['block_id'];?>
);">修改名称</a>
	<a href="/sys-admin/action/cms/store.php?met=storelist&bid=<?php echo $_smarty_tpl->tpl_vars['footblock']->value['block_id'];?>
">内容管理</a>
	</td>
    </tr>
    <?php } ?>
  	</table>
 	</div>
</div>
</div>
<script type="text/javascript">
function popAddCommonBlock(pos){
	var html ='名　称：<input type="text" maxlength="30" size="20" num="1" id="b_name" vmin="0" vmax="30">'
	 	+ '<p>唯一码：<input type="text" maxlength="30" size="20" id="b_sn" vmin="0" vmax="30"></p>'
	 	+ '<p>类　型：<select name="type" id="b_type"><option value="1">超链接</option><option value="2">图片</option><option value="3">产品</option></select></p>'
	 	+ '<input class="button" type="button" value="添加" onclick="addCommonBlock('+pos+');">';
	    popDailog('添加块',html,160);
}
function addCommonBlock(pos){
	if(!Fun.requiredLetterDigitalChineseCheck($('#b_name'))){
		alert('名称必须为中文、数字或字母');
		return;
	}
	if(!Fun.requiredwCheck($('#b_sn'))){
		alert('唯一码必须为数字、字母或_');
		return;
	}
	var name = $.trim($('#b_name').val());
	var sn = $.trim($('#b_sn').val());
	var type = $('#b_type').val();
	var url = '/sys-admin/action/cms/block.php?met=addcommon'
	       +'&name='+name
	       +'&sn='+sn
	       +'&type='+type
	       +'&pos='+pos
	       +'&t='+(new Date().getTime());
	$.get(url,null,function(result){
		result = $.trim(result);
		var json = eval('('+result+')');
		if(json.code == 1){
			var typename='';
			switch (type) {
		        case '1':typename = '超链接';break;
		        case '2':typename = '图片';break;
		        case '3':typename = '产品';break;
		        default:;
			}
			var html='<tr id="b_'+json.id+'"><td>-</td><td>'+name+'</td><td>'+sn+'</td><td>'+typename+'</td><td>'
					+'<a href="javascript:delBlock('+json.id+');">删除</a>'
					+'<a href="javascript:popEditBlockName('+json.id+');">修改名称</a>'
					+'<a href="/sys-admin/action/cms/store.php?met=storelist&bid='+json.id+'">内容管理</a>'
					+'</td></tr>'
			$('#tb_'+pos).append(html);
			closeUpImg();
			alert('添加成功');
		}else if(json.code == 2){
			alert('唯一码已被占用');
		}else{
			alert('添加失败');
		}
	});
}

function delBlock(id){
	var name = $('#b_'+id).find('td').eq(1).html();
	if(confirm('确定要删除'+name+'?')){
		var url = '/sys-admin/action/cms/block.php?met=delblock'
		       +'&id='+id
		       +'&t='+(new Date().getTime());
		$.get(url,null,function(result){
			if($.trim(result) == "1"){
				$('#b_'+id).remove();
				alert("删除成功");
			}else{
				alert("删除失败");
			}
		});
	}
}

function popEditBlockName(id){
	var name = $.trim($('#b_'+id).find('td').eq(1).html());
	var html ='名　称：<input type="text" maxlength="30" size="20" value="'+name+'" num="1" id="b_name" vmin="0" vmax="30">'
	 	+ '<br/><input class="button" type="button" value="修改" onclick="editBlockName('+id+');">';
	    popDailog('修改名称',html,160);
}


function editBlockName(id){
	if(!Fun.requiredLetterDigitalChineseCheck($('#b_name'))){
		alert('名称必须为中文、数字或字母');
		return;
	}
	var name = $.trim($('#b_name').val());
	var url = '/sys-admin/action/cms/block.php?met=editnameblock'
	       +'&name='+name
	       +'&id='+id
	       +'&t='+(new Date().getTime());
	$.get(url,null,function(result){
		if($.trim(result) == "1"){
			$('#b_'+id).find('td').eq(1).html(name);
			closeUpImg();
			alert("修改成功");
		}else{
			alert("修改失败");
		}
	});
}



function staticCommon(pos){
	if(confirm('确定要生成网页?')){
		var url = '/sys-admin/action/staticfile/staticfile.php?met=staticcommon'
		       +'&pos='+pos
		       +'&t='+(new Date().getTime());
		$.get(url,null,function(result){
			if($.trim(result) == "1"){
				alert("生成网页成功");
			}else{
				alert("生成网页失败,请确认数据和模板是否正确");
			}
		});
	}
}





</script>
</body></html><?php }} ?>